package com.shiyi.shiyiaiagent.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shiyi.shiyiaiagent.chatMemory.entity.ChatMessage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Administrator
* @description 针对表【chat_messages】的数据库操作Mapper
* @createDate 2025-05-21 11:39:16
* @Entity generator.domain.ChatMessages
*/
public interface ChatMessagesMapper extends BaseMapper<ChatMessage> {
  @Select("SELECT * FROM chat_messages WHERE conversation_id = #{conversationId} ORDER BY created_at ASC")
  List<ChatMessage> selectByConversationId(@Param("conversationId") String conversationId);

  @Delete("DELETE FROM chat_messages WHERE conversation_id = #{conversationId}")
  int deleteByConversationId(@Param("conversationId") String conversationId);
}




